package model.entity.role;

import java.util.ArrayList;
import java.util.List;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.OneToMany;
import javax.persistence.SequenceGenerator;
import javax.persistence.Table;

@Entity
@Table(name = "GroupRole")
public class GroupRole {

	private int roleId;
	private String roleName;
	private List<Users> users = new ArrayList<Users>(0);
	private List<PageTask> pageTasks = new ArrayList<PageTask>(0);

	public GroupRole() {
	}

	public GroupRole(String roleName) {
		this.roleName = roleName;
	}

	public GroupRole(String roleName, List<Users> users,
			List<PageTask> pageTasks) {
		this.roleName = roleName;
		this.users = users;
		this.pageTasks = pageTasks;
	}

	@Id
	@GeneratedValue(generator = "GroupRole_ID_Gen", strategy = GenerationType.IDENTITY)
	@SequenceGenerator(name = "GroupRole_ID_Gen", sequenceName = "GroupRole_SEQ_ID")
	@Column(name = "RoleID", unique = true, nullable = false)
	public int getRoleId() {
		return this.roleId;
	}

	public void setRoleId(int roleId) {
		this.roleId = roleId;
	}

	@Column(name = "RoleName", nullable = false)
	public String getRoleName() {
		return this.roleName;
	}

	public void setRoleName(String roleName) {
		this.roleName = roleName;
	}

	@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "groupRole")
	public List<Users> getUsers() {
		return this.users;
	}

	public void setUsers(List<Users> users) {
		this.users = users;
	}

	@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "groupRole")
	public List<PageTask> getPageTasks() {
		return this.pageTasks;
	}

	public void setPageTasks(List<PageTask> pageTasks) {
		this.pageTasks = pageTasks;
	}

}
